package com.by_man.presenter.module_health_management.health_reminder;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Vibrator;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.by_man.presenter.R;

/**
 * Created by man on 2017-02-22.
 */
public class AlarmClose extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alarm_close);
        Intent intent = getIntent();
        String item = intent.getStringExtra("item");

        TextView item_name = (TextView) findViewById(R.id.item_name);
        item_name.setText(item + "时间到了！");

        final Vibrator w;
        w=(Vibrator)AlarmClose.this.getSystemService(Context.VIBRATOR_SERVICE);
        w.vibrate(30000);

        Button closeBtn = (Button) findViewById(R.id.close_alarm);
        closeBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                w.cancel();
                finish();
            }
        });
    }
}
